package com.itheima.anno;

import com.itheima.validation.StateValidation;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import jakarta.validation.constraints.NotEmpty;

import java.lang.annotation.*;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Documented
@Retention(RUNTIME)
@Target({ElementType.FIELD})
@Constraint(
        validatedBy = {StateValidation.class}
)
public @interface State {
    //当校验不通过时提示的信息
    String message() default "state参数的值只能是已发布或者草稿";
    //设置分组校验
    Class<?>[] groups() default {};
    //负载，可以获取到State注解中的附加信息
    Class<? extends Payload>[] payload() default {};

}
